﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace EbbinghausWord.Entities
{
    /// <summary>
    /// 书籍发音文件类
    /// </summary>
    public class BookVoiceEntity : BaseTableEntity
    {
        /// <summary>
        /// 书籍Id
        /// </summary>
        public int BookId { get; set; }

        /// <summary>
        /// 书籍名称
        /// </summary>
        public string BookName { get; set; }

        /// <summary>
        /// 单词总数
        /// </summary>
        public int TotalWordCount { get; set; }

        /// <summary>
        /// 已下载的声音文件数量
        /// </summary>
        public int HasDownloadWordCount { get; set; }

        //private int _hasDownloadWordCount;

        //public int HasDownloadWordCount
        //{
        //    get { return _hasDownloadWordCount; }
        //    set
        //    {
        //        if (_hasDownloadWordCount == value) return;

        //        NotifyPropertyChanging("TotalMessage");
        //        NotifyPropertyChanging("HasDownloadWordCount");
        //        _hasDownloadWordCount = value;
        //        NotifyPropertyChanged("TotalMessage");
        //        NotifyPropertyChanged("HasDownloadWordCount");
        //    }
        //}


        /// <summary>
        /// 汇总信息，显示的时候使用
        /// </summary>
        public string TotalMessage
        {
            get { return string.Format("已下载 {0} ，共 {1} 个", HasDownloadWordCount, TotalWordCount); }
        }

        /// <summary>
        /// 下载图标的地址
        /// </summary>
        public string IconPath
        {
            get
            {
                return TotalWordCount == HasDownloadWordCount
                           ? @"/Images\voice-check.png"
                           : @"/Images\voice-download.png";
            }
        }

        /// <summary>
        /// 是否启用下载按钮
        /// </summary>
        public bool IsEnabledButton
        {
            get { return TotalWordCount != HasDownloadWordCount; }
        }

    }
}
